// document.write('search something...')

// 'use strict';

import React from 'react';
import ReactDOM from 'react-dom';

import './search.less';
import img1 from './imgs/101.jpg';

import '../../common/index';

import { a } from './tree-shaking';

import largeNumber from 'lss-largenumber';

class Search extends React.Component {
  constructor() {
    super(...arguments);

    this.state = {
      Text: null,
    };
  }

  loadComponent() {
    import('./text.js').then((TextComponent) => {
      this.setState({
        Text: TextComponent.default,
      });
    });
  }

  render() {
    const strA = a();
    // debugger;
    const { Text } = this.state;
    const addResult = largeNumber('999', '3');
    return (
      <div className="search-text">
        <div>
          {
                    Text ? <Text /> : null
                }
        </div>
        <div>
          { addResult }
        </div>
        <div>
          Search Text, hello webpack, 你好, 你好长城!
        </div>
        <div>
          { strA }
        </div>
        <div>
          <img src={img1} onClick={this.loadComponent.bind(this)} />
        </div>
      </div>
    );
  }
}

ReactDOM.render(
  <Search />,
  document.getElementById('root'),
);
